\(\int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx\) [259]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 26, antiderivative size = 51 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {e x}{a}+\frac {f x^2}{2 a}+\frac {(e+f x) \cos (c+d x)}{a d}-\frac {f \sin (c+d x)}{a d^2} \]

[Out]

e*x/a+1/2*f*x^2/a+(f*x+e)*cos(d*x+c)/a/d-f*sin(d*x+c)/a/d^2

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {4619, 3377, 2717} \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {f \sin (c+d x)}{a d^2}+\frac {(e+f x) \cos (c+d x)}{a d}+\frac {e x}{a}+\frac {f x^2}{2 a} \]

[In]

Int[((e + f*x)*Cos[c + d*x]^2)/(a + a*Sin[c + d*x]),x]

[Out]

(e*x)/a + (f*x^2)/(2*a) + ((e + f*x)*Cos[c + d*x])/(a*d) - (f*Sin[c + d*x])/(a*d^2)

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 4619

Int[(Cos[(c_.) + (d_.)*(x_)]^(n_)*((e_.) + (f_.)*(x_))^(m_.))/((a_) + (b_.)*Sin[(c_.) + (d_.)*(x_)]), x_Symbol
] :> Dist[1/a, Int[(e + f*x)^m*Cos[c + d*x]^(n - 2), x], x] - Dist[1/b, Int[(e + f*x)^m*Cos[c + d*x]^(n - 2)*S
in[c + d*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 1] && EqQ[a^2 - b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\int (e+f x) \, dx}{a}-\frac {\int (e+f x) \sin (c+d x) \, dx}{a} \\ & = \frac {e x}{a}+\frac {f x^2}{2 a}+\frac {(e+f x) \cos (c+d x)}{a d}-\frac {f \int \cos (c+d x) \, dx}{a d} \\ & = \frac {e x}{a}+\frac {f x^2}{2 a}+\frac {(e+f x) \cos (c+d x)}{a d}-\frac {f \sin (c+d x)}{a d^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.45 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.04 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {(c+d x) (-2 d e+c f-d f x)-2 d (e+f x) \cos (c+d x)+2 f \sin (c+d x)}{2 a d^2} \]

[In]

Integrate[((e + f*x)*Cos[c + d*x]^2)/(a + a*Sin[c + d*x]),x]

[Out]

-1/2*((c + d*x)*(-2*d*e + c*f - d*f*x) - 2*d*(e + f*x)*Cos[c + d*x] + 2*f*Sin[c + d*x])/(a*d^2)

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.86

method result size
parallelrisch \(\frac {d \cos \left (d x +c \right ) \left (f x +e \right )-f \sin \left (d x +c \right )+\left (x \left (\frac {f x}{2}+e \right ) d +e \right ) d}{a \,d^{2}}\) \(44\)
risch \(\frac {e x}{a}+\frac {f \,x^{2}}{2 a}+\frac {\left (f x +e \right ) \cos \left (d x +c \right )}{a d}-\frac {f \sin \left (d x +c \right )}{a \,d^{2}}\) \(50\)
derivativedivides \(\frac {-\cos \left (d x +c \right ) c f +\cos \left (d x +c \right ) d e -f \left (\sin \left (d x +c \right )-\cos \left (d x +c \right ) \left (d x +c \right )\right )-f c \left (d x +c \right )+e d \left (d x +c \right )+\frac {f \left (d x +c \right )^{2}}{2}}{d^{2} a}\) \(78\)
default \(\frac {-\cos \left (d x +c \right ) c f +\cos \left (d x +c \right ) d e -f \left (\sin \left (d x +c \right )-\cos \left (d x +c \right ) \left (d x +c \right )\right )-f c \left (d x +c \right )+e d \left (d x +c \right )+\frac {f \left (d x +c \right )^{2}}{2}}{d^{2} a}\) \(78\)
norman \(\frac {\frac {2 e}{d a}+\frac {f \,x^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {f \,x^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {\left (d e +f \right ) x}{d a}-\frac {2 f \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a \,d^{2}}+\frac {\left (2 d e -2 f \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a \,d^{2}}+\frac {\left (d e -f \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {\left (d e -f \right ) x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {\left (d e +f \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}+\frac {f \,x^{2}}{2 a}+\frac {2 e x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {2 e x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}+\frac {f \,x^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a}+\frac {f \,x^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a}+\frac {f \,x^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 a}+\frac {2 \left (d e -f \right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a \,d^{2}}+\frac {2 \left (d e -f \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a \,d^{2}}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}\) \(364\)

[In]

int((f*x+e)*cos(d*x+c)^2/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

(d*cos(d*x+c)*(f*x+e)-f*sin(d*x+c)+(x*(1/2*f*x+e)*d+e)*d)/a/d^2

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 49, normalized size of antiderivative = 0.96 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {d^{2} f x^{2} + 2 \, d^{2} e x + 2 \, {\left (d f x + d e\right )} \cos \left (d x + c\right ) - 2 \, f \sin \left (d x + c\right )}{2 \, a d^{2}} \]

[In]

integrate((f*x+e)*cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(d^2*f*x^2 + 2*d^2*e*x + 2*(d*f*x + d*e)*cos(d*x + c) - 2*f*sin(d*x + c))/(a*d^2)

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 326 vs. \(2 (41) = 82\).

Time = 1.30 (sec) , antiderivative size = 326, normalized size of antiderivative = 6.39 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\begin {cases} \frac {2 d^{2} e x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} + \frac {2 d^{2} e x}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} + \frac {d^{2} f x^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} + \frac {d^{2} f x^{2}}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} + \frac {4 d e}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} - \frac {2 d f x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} + \frac {2 d f x}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} - \frac {4 f \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{2 a d^{2} \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 2 a d^{2}} & \text {for}\: d \neq 0 \\\frac {\left (e x + \frac {f x^{2}}{2}\right ) \cos ^{2}{\left (c \right )}}{a \sin {\left (c \right )} + a} & \text {otherwise} \end {cases} \]

[In]

integrate((f*x+e)*cos(d*x+c)**2/(a+a*sin(d*x+c)),x)

[Out]

Piecewise((2*d**2*e*x*tan(c/2 + d*x/2)**2/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2) + 2*d**2*e*x/(2*a*d**2*tan
(c/2 + d*x/2)**2 + 2*a*d**2) + d**2*f*x**2*tan(c/2 + d*x/2)**2/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2) + d**
2*f*x**2/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2) + 4*d*e/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2) - 2*d*f*x
*tan(c/2 + d*x/2)**2/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2) + 2*d*f*x/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d
**2) - 4*f*tan(c/2 + d*x/2)/(2*a*d**2*tan(c/2 + d*x/2)**2 + 2*a*d**2), Ne(d, 0)), ((e*x + f*x**2/2)*cos(c)**2/
(a*sin(c) + a), True))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 151 vs. \(2 (49) = 98\).

Time = 0.29 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.96 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {4 \, c f {\left (\frac {1}{a d + \frac {a d \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}} + \frac {\arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a d}\right )} - 4 \, e {\left (\frac {\arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} + \frac {1}{a + \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}}\right )} - \frac {{\left ({\left (d x + c\right )}^{2} + 2 \, {\left (d x + c\right )} \cos \left (d x + c\right ) - 2 \, \sin \left (d x + c\right )\right )} f}{a d}}{2 \, d} \]

[In]

integrate((f*x+e)*cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(4*c*f*(1/(a*d + a*d*sin(d*x + c)^2/(cos(d*x + c) + 1)^2) + arctan(sin(d*x + c)/(cos(d*x + c) + 1))/(a*d)
) - 4*e*(arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a + 1/(a + a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)) - ((d*x +
c)^2 + 2*(d*x + c)*cos(d*x + c) - 2*sin(d*x + c))*f/(a*d))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 322 vs. \(2 (49) = 98\).

Time = 0.30 (sec) , antiderivative size = 322, normalized size of antiderivative = 6.31 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {d^{2} f x^{2} \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d^{2} e x \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + d^{2} f x^{2} \tan \left (\frac {1}{2} \, d x\right )^{2} + d^{2} f x^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d f x \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d^{2} e x \tan \left (\frac {1}{2} \, d x\right )^{2} + 2 \, d^{2} e x \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d e \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + d^{2} f x^{2} - 2 \, d f x \tan \left (\frac {1}{2} \, d x\right )^{2} - 8 \, d f x \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right ) - 2 \, d f x \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d^{2} e x - 2 \, d e \tan \left (\frac {1}{2} \, d x\right )^{2} - 8 \, d e \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right ) + 4 \, f \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - 2 \, d e \tan \left (\frac {1}{2} \, c\right )^{2} + 4 \, f \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, d f x + 2 \, d e - 4 \, f \tan \left (\frac {1}{2} \, d x\right ) - 4 \, f \tan \left (\frac {1}{2} \, c\right )}{2 \, {\left (a d^{2} \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + a d^{2} \tan \left (\frac {1}{2} \, d x\right )^{2} + a d^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + a d^{2}\right )}} \]

[In]

integrate((f*x+e)*cos(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

1/2*(d^2*f*x^2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*d^2*e*x*tan(1/2*d*x)^2*tan(1/2*c)^2 + d^2*f*x^2*tan(1/2*d*x)^2
+ d^2*f*x^2*tan(1/2*c)^2 + 2*d*f*x*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*d^2*e*x*tan(1/2*d*x)^2 + 2*d^2*e*x*tan(1/2*
c)^2 + 2*d*e*tan(1/2*d*x)^2*tan(1/2*c)^2 + d^2*f*x^2 - 2*d*f*x*tan(1/2*d*x)^2 - 8*d*f*x*tan(1/2*d*x)*tan(1/2*c
) - 2*d*f*x*tan(1/2*c)^2 + 2*d^2*e*x - 2*d*e*tan(1/2*d*x)^2 - 8*d*e*tan(1/2*d*x)*tan(1/2*c) + 4*f*tan(1/2*d*x)
^2*tan(1/2*c) - 2*d*e*tan(1/2*c)^2 + 4*f*tan(1/2*d*x)*tan(1/2*c)^2 + 2*d*f*x + 2*d*e - 4*f*tan(1/2*d*x) - 4*f*
tan(1/2*c))/(a*d^2*tan(1/2*d*x)^2*tan(1/2*c)^2 + a*d^2*tan(1/2*d*x)^2 + a*d^2*tan(1/2*c)^2 + a*d^2)

Mupad [B] (verification not implemented)

Time = 2.57 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.04 \[ \int \frac {(e+f x) \cos ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\frac {f\,x^2}{2}+e\,x}{a}-\frac {f\,\sin \left (c+d\,x\right )-d\,\left (e\,\cos \left (c+d\,x\right )+f\,x\,\cos \left (c+d\,x\right )\right )}{a\,d^2} \]

[In]

int((cos(c + d*x)^2*(e + f*x))/(a + a*sin(c + d*x)),x)

[Out]

(e*x + (f*x^2)/2)/a - (f*sin(c + d*x) - d*(e*cos(c + d*x) + f*x*cos(c + d*x)))/(a*d^2)